<?php
/**
 * Created by PhpStorm.
 * User: td
 * Date: 15/1/22
 * Time: 上午1:00
 */

namespace Home\Controller;
use Think\Controller;

class FetcherInfoController extends Controller{

    //乙方个人主页
    public function fetcherInfoIndex(){
        if(isset($_SESSION['loginUser'])){
            $this->display('FetcherInfo');
        }else{
            $this->error('请登陆系统',U('Login/index'));
        }
    }

    //乙方个人主页基本信息
    public function fetcherInfoBase(){
        if(isset($_SESSION['loginUser'])){
            $user_id = $_GET['user_id'];
            if(IS_GET){
                $user_ext_db = D('UserExt');
                $user_ext_result = $user_ext_db->getFetcherBaseInfo($user_id);
                if($user_ext_result){
                    $this->success('获取信息成功',$user_ext_result);
                }else{
                    $this->error('获取信息失败');
                }
            }
        }else{
            $this->error('请登陆系统',U('Login/index'));
        }
    }

    //乙方个人主页信任圈子
    public function trustInfo(){
        if(isset($_SESSION['loginUser'])){
            $trusted_id = $_GET['user_id'];
            if(IS_GET){
                $trust_db = D('Trust');
                $trust_result = $trust_db->getTrusterInfo($trusted_id);
                if($trust_result){
                    $this->success('获取信息成功',$trust_result);
                }else{
                    $this->error('获取信息失败');
                }
            }
        }else{
            $this->error('请登系统',U('Login/index'));
        }
    }

    //乙方个人主页－甲方信息
    public function fetcherJFInfo(){
        if(isset($_SESSION['loginUser'])){
            $user_id = $_GET['user_id'];
            if(IS_GET){
                $user_ext_db = D('UserExt');
                $user_ext_result = $user_ext_db->getFetcherJFInfo($user_id);
                if($user_ext_result){
                    $this->success('获取信息成功',$user_ext_result);
                }else{
                    $this->error('获取信息失败');
                }
            }
        }else{
            $this->error('请登陆系统',U('Login/index'));
        }
    }

    //test
    public function test(){
//        $trusted_id = $_GET['trusted_id'];
//        $trust_db = D('Trust');
//        $trust_result = $trust_db->getTrusterInfo($trusted_id);
//        dump($trust_result);

        $user_id = $_GET['user_id'];
        $user_ext_db = D('UserExt');
        $user_ext_result = $user_ext_db->getFetcherJFInfo($user_id);
        dump($user_ext_result);
    }

} 